package cmd

import (
	"fmt"
	"github.com/spf13/cobra"
	"github.com/spf13/pflag"
)

var version = "1.0.0"

var rootCmd = &cobra.Command{
	Use:  "wj",
	Long: `Java Version Manager (https://github.com/JACKWHH/wjvm-cli).`,
	Run: func(cmd *cobra.Command, args []string) {
		if showVersion, _ := cmd.Flags().GetBool("version"); !showVersion {
			fmt.Println(pflag.ErrHelp)
			return
		}
		fmt.Println(version)
	},
}

func Execute() {
	_ = rootCmd.Execute()
}
